package org.blogwu.learn.threadLearn.class19;

public class Thread1 {

    public static boolean bb = true;

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(new Runnable() {

            int i = 0;

            @Override
            public void run() {
                while (true) {
                    if (Thread1.bb) {
                        i++;
                    } else {
                        break;
                    }
                }
                System.out.println("i= " + i);
            }
        });
        t1.start();
        Thread.sleep(500);
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                Thread1.bb = false;
            }
        });
        t2.start();
    }
}
